Skip to content

dlck_vos_cont_recs_get_active() unit tests#30

Merged
janekmi merged 3 commits into
janekmi/DAOS-17569-DLCK-DAE-records-recover-mainfrom
dlck_vos_cont_recs_get_active-uts
Aug 7, 2025
Merged

dlck_vos_cont_recs_get_active() unit tests#30
janekmi merged 3 commits into
janekmi/DAOS-17569-DLCK-DAE-records-recover-mainfrom
dlck_vos_cont_recs_get_active-uts

Conversation

@janekmi
Copy link
Copy Markdown
Owner

@janekmi janekmi commented Jul 31, 2025

This change is Reviewable

Signed-off-by: Jan Michalski <jan-marian.michalski@hpe.com>
@janekmi janekmi requested a review from osalyk July 31, 2025 19:10
@github-actions
Copy link
Copy Markdown

Errors are component not formatted correctly,Ticket number prefix incorrect,PR title is malformatted. See https://daosio.atlassian.net/wiki/spaces/DC/pages/11133911069/Commit+Comments,Unable to load ticket data
https://daosio.atlassian.net/browse/dlck_vos_cont_recs_get_active()

Copy link
Copy Markdown
Collaborator

@osalyk osalyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @janekmi)


src/utils/dlck/tests/dlck_vos_cont_recs_get_active_ut.c line 88 at r1 (raw file):

	assert_ptr_equal(dv, DV_MOCK);
	return mock_type(int);
}

Macros or maybe aliases?

Code quote:

int
dlck_obj_get_active(daos_handle_t coh, struct vos_iterator *iter, d_vector_t *dv)
{
	assert_int_equal(coh.cookie, Coh.cookie);
	assert_ptr_equal(iter, VOS_ITER_MOCK);
	assert_ptr_equal(dv, DV_MOCK);
	return mock_type(int);
}

int
dlck_irec_get_active(daos_handle_t coh, struct vos_iterator *iter, d_vector_t *dv)
{
	assert_int_equal(coh.cookie, Coh.cookie);
	assert_ptr_equal(iter, VOS_ITER_MOCK);
	assert_ptr_equal(dv, DV_MOCK);
	return mock_type(int);
}

int
dlck_sv_add_if_active(daos_handle_t coh, struct vos_iterator *iter, d_vector_t *dv)
{
	assert_int_equal(coh.cookie, Coh.cookie);
	assert_ptr_equal(iter, VOS_ITER_MOCK);
	assert_ptr_equal(dv, DV_MOCK);
	return mock_type(int);
}

int
dlck_ev_add_if_active(daos_handle_t coh, struct vos_iterator *iter, d_vector_t *dv)
{
	assert_int_equal(coh.cookie, Coh.cookie);
	assert_ptr_equal(iter, VOS_ITER_MOCK);
	assert_ptr_equal(dv, DV_MOCK);
	return mock_type(int);
}

Copy link
Copy Markdown
Owner Author

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @osalyk)


src/utils/dlck/tests/dlck_vos_cont_recs_get_active_ut.c line 88 at r1 (raw file):

Previously, osalyk (Oksana Sałyk) wrote…

Macros or maybe aliases?

  1. We can't have a helper function here for two reasons:
  • having assert_*() in a helper will also cause the error report to point a helper instead of the function the helper was called from.
  • mock_type(int) has to be in a function the value is prepared for. So, providing values for a helper instead for the mocked functions directly will highly decrease the tests readability.
  1. We can't have a macro either:
  • the error report will point a single line where the macro was used at best. Considering there are three assertions there it will be tricky to determine where the issue is.

Considering all of the above and that there are only 4 such functions I believe it would be best to keep them as they are.

Copy link
Copy Markdown
Collaborator

@osalyk osalyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)


src/utils/dlck/tests/dlck_vos_cont_recs_get_active_ut.c line 88 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…
  1. We can't have a helper function here for two reasons:
  • having assert_*() in a helper will also cause the error report to point a helper instead of the function the helper was called from.
  • mock_type(int) has to be in a function the value is prepared for. So, providing values for a helper instead for the mocked functions directly will highly decrease the tests readability.
  1. We can't have a macro either:
  • the error report will point a single line where the macro was used at best. Considering there are three assertions there it will be tricky to determine where the issue is.

Considering all of the above and that there are only 4 such functions I believe it would be best to keep them as they are.

pity, but I understand

@janekmi janekmi force-pushed the dlck_vos_cont_recs_get_active-uts branch from ed51362 to 76d6f8d Compare August 7, 2025 15:02
janekmi added 2 commits August 7, 2025 15:09
Signed-off-by: Jan Michalski <jan-marian.michalski@hpe.com>
Signed-off-by: Jan Michalski <jan-marian.michalski@hpe.com>
@janekmi janekmi merged commit 09441c6 into janekmi/DAOS-17569-DLCK-DAE-records-recover-main Aug 7, 2025
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants